#
#  Copyright (C) 2009 GSyC/LibreSoft
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
#    Author : Jose Antonio Santos Cadenas <jcaden __at__ gsyc __dot__ es>
#


from django.conf.urls.defaults import patterns, url
from django.views.generic.simple import direct_to_template
from social.rest.forms import PhotoForm, SoundForm

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^pinax_sn_rest/', include('pinax_sn_rest.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/(.*)', admin.site.root),
#    (r'^$', 'pinax_sn.views.main'),
    #url(r'^$', direct_to_template, {"template": "social_test.html",} , name="test"),
    url(r'^$', direct_to_template, {"template": "social_test.html", "extra_context":{"photo_form": PhotoForm(), "sound_form": SoundForm() }}, name="test"),
    url(r'^test/group/(?P<group>[1-9][0-9]*)/map/$', 'social.rest.test.group_map', name="group_map"),
    url(r'^test/group/map/$', 'social.rest.test.groups_map', name="groups_map"),
    
    #url(r'^node/(?P<node>[1-9][0-9]*)/near_nodes/$', 'social.rest.views.node_near', name="node_near"),
    #url(r'^node/(?P<node_id>[1-9][0-9]*)/data/$', 'social.rest.views.node_data', name="node_data"),
    url(r'^node/(?P<node_id>[1-9][0-9]*)/position_update/$', 'social.rest.views.node_set_position', name="node_set_position"),
    #url(r'^node/list/$', 'social.rest.views.node_list', name="node_list"),

    url(r'^node/(?P<node_id>[1-9][0-9]*)/tag/$', 'social.rest.views.node_tag', name="node_tag"),
    url(r'^node/(?P<node_id>[1-9][0-9]*)/untag/$', 'social.rest.views.node_untag', name="node_untag"),
    
    url(r'^node/(?P<node_id>[1-9][0-9]*)/comment/$', 'social.rest.views.node_comment', name="node_comment"),
    url(r'^node/comment/delete/$', 'social.rest.views.node_delete_comment', name="node_delete_comment"),

    url(r'^note/create/$', 'social.rest.views.create_note', name="create_note"),
    url(r'^note/list/$', 'social.rest.views.note_list', name="note_list"),
    url(r'^note/(?P<note_id>[1-9][0-9]*)/data/$', 'social.rest.views.note_data', name="note_data"),
    url(r'^note/delete/$', 'social.rest.views.note_delete', name="note_delete"),

    url(r'^user/login/$', 'social.rest.views.user_login', name="user_login"),
    url(r'^user/create/$', 'social.rest.views.user_create_or_modify', name="user_create"),
    url(r'^user/modify/$', 'social.rest.views.user_create_or_modify', {"modify":True}, name="user_modify"),
    url(r'^user/(?P<user>[1-9][0-9]*)/position/$', 'social.rest.views.user_position', name="user_pos_id"),
    url(r'^user/position/$', 'social.rest.views.user_position', name="user_pos"),
    url(r'^user/(?P<user>[1-9][0-9]*)/data/$', 'social.rest.views.user_data', name="user_data_id"),
    url(r'^user/my_data/$', 'social.rest.views.user_my_data', name="user_my_data"),
    url(r'^user/data/$', 'social.rest.views.user_my_data', name="user_data"),
    url(r'^user/(?P<user>[1-9][0-9]*)/friends/$', 'social.rest.views.user_friends', name="user_friends"),
    url(r'^user/friends/$', 'social.rest.views.user_friends', name="user_my_friends"),
    url(r'^user/(?P<user>[1-9][0-9]*)/friendship_invitations/$', 'social.rest.views.user_friendship_invitations', name="user_friendship_invitation"),
    url(r'^user/friendship_invitations/$', 'social.rest.views.user_friendship_invitations', name="user_my_friendship_invitations"),
    url(r'^user/(?P<user>[1-9][0-9]*)/near_people/$', 'social.rest.views.user_near', name="user_near"),
    url(r'^user/near_people/$', 'social.rest.views.user_near', name="user_near_own"),
    url(r'^user/near_friends/$', 'social.rest.views.user_near_friends', name="user_near_friends"),
    url(r'^user/(?P<user>[1-9][0-9]*)/set_status/$', 'social.rest.views.user_set_status', name="user_set_status_id"),
    url(r'^user/(?P<user>[1-9][0-9]*)/photos/$', 'social.rest.views.user_photos', name="user_photos_id"),
    url(r'^user/photos/$', 'social.rest.views.user_photos', name="user_photos"),
    url(r'^user/(?P<user>[1-9][0-9]*)/sounds/$', 'social.rest.views.user_sounds', name="user_sounds_id"),
    url(r'^user/sounds/$', 'social.rest.views.user_sounds', name="user_sounds"),
    url(r'^user/(?P<user>[1-9][0-9]*)/notes/$', 'social.rest.views.user_notes', name="user_notes_id"),
    url(r'^user/notes/$', 'social.rest.views.user_notes', name="user_notes"),
    url(r'^user/set_status/$', 'social.rest.views.user_set_status', name="user_set_status"),
    url(r'^user/set_avatar/$', 'social.rest.views.user_set_avatar', name="user_set_avatar"),
    url(r'^user/list/$', 'social.rest.views.user_all', name="user_all"),
    url(r'^user/delete/$', 'social.rest.views.user_delete', name="user_delete"),
    url(r'^user/relation/$', 'social.rest.views.user_relation', name="user_relation"),
    url(r'^user/relation/delete/$', 'social.rest.views.user_relation_delete', name="user_relation_delete"),
    url(r'^user/groups/$', 'social.rest.views.user_groups', name="user_groups"),
    
    url(r'^group/list/$', 'social.rest.views.group_list', name="group_list"),
    url(r'^group/create/$', 'social.rest.views.group_create', name="group_create"),
    url(r'^group/(?P<group>[1-9][0-9]*)/data/$', 'social.rest.views.group_data', name="group_data"),
    url(r'^group/(?P<group>[1-9][0-9]*)/elements/$', 'social.rest.views.group_elements', name="group_elements"),
    url(r'^group/delete/$', 'social.rest.views.group_delete', name="group_delete"),
    url(r'^group/join/$', 'social.rest.views.group_join', name="group_join"),
    url(r'^group/join/delete/$', 'social.rest.views.group_join_delete', name="group_unjoin"),
    
    url(r'^question/getquestion/$', 'social.rest.views.question_get', name="question_get"),
    url(r'^question/sendanswer/$', 'social.rest.views.send_answer', name="send_answer"),

    url(r'^photo/upload/$', 'social.rest.views.photo_upload', name="photo_upload"),
    url(r'^photo/list/$', 'social.rest.views.photo_list', name="photo_list"),
    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/data/$', 'social.rest.views.photo_data', name="photo_data"),
    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/image/$', 'social.rest.views.photo_image', name="photo_image"),
    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/image/thumb/$', 'social.rest.views.photo_image', {"thumb": True}, name="photo_image_thumb"),
    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/image/large/$', 'social.rest.views.photo_image', {"size": "large"}, name="photo_image_large"),
    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/image/medium/$', 'social.rest.views.photo_image', {"size": "medium"}, name="photo_image_medium"),
    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/image/small/$', 'social.rest.views.photo_image', {"size": "small"}, name="photo_image_small"),
    url(r'^photo/delete/$', 'social.rest.views.photo_delete', name="photo_delete"),
    
    url(r'^sound/upload/$', 'social.rest.views.sound_upload', name="sound_upload"),
    url(r'^sound/list/$', 'social.rest.views.sound_list', name="sound_list"),
    url(r'^sound/(?P<sound_id>[1-9][0-9]*)/data/$', 'social.rest.views.sound_data', name="sound_data"),
    url(r'^sound/(?P<sound_id>[1-9][0-9]*)/file/$', 'social.rest.views.sound_file', name="sound_file"),
    url(r'^sound/delete/$', 'social.rest.views.sound_delete', name="sound_delete"),

    url(r'^search/$', 'social.rest.views.search', name="search"),
    url(r'^search/tag/(?P<tag>\w+)/$', 'social.rest.views.tag_list', name="tag_list"),
    
    url(r'^node/(?P<node_id>[1-9][0-9]*)/privacy/status/$', 'social.rest.privacy.privacy', name="node_privacy"),
    url(r'^user/privacy/status/$', 'social.rest.privacy.privacy', name="privacy"),
    
    url(r'^node/(?P<node_id>[1-9][0-9]*)/privacy/change/$', 'social.rest.privacy.change_privacy', name="node_change_privacy"),
    url(r'^user/privacy/change/$', 'social.rest.privacy.change_privacy', name="change_privacy"),
    
    url(r'^layer/(?P<layer_id>(.*))/search/$', 'social.rest.layers.layer_request', name="layer_request"),
    url(r'^layer/(?P<layer_id>(.*))/info/$', 'social.rest.layers.layer_info', name="layer_info"),
    url(r'^layer/(?P<layer_id>(.*))/icon/$', 'social.rest.layers.layer_icon', name="layer_icon"),
    
#===============================================================================
#    url(r'^user/privacy/restrict/$', 'social.rest.privacy.restrict', name="privacy_restrict"),
#    url(r'^user/privacy/restrict/delete/$', 'social.rest.privacy.restrict', {"undo": True}, name="privacy_restrict_undo"),
#    url(r'^user/privacy/allow/$', 'social.rest.privacy.allow', name="privacy_allow"),
#    url(r'^user/privacy/allow/delete/$', 'social.rest.privacy.allow', {"undo": True}, name="privacy_allow_undo"),
#    
#    url(r'^note/(?P<note_id>[1-9][0-9]*)/privacy/$', 'social.rest.privacy.note_privacy', name="note_privacy"),
#    url(r'^note/(?P<note_id>[1-9][0-9]*)/privacy/restrict/$', 'social.rest.privacy.note_restrict', name="note_privacy_restrict"),
#    url(r'^note/(?P<note_id>[1-9][0-9]*)/privacy/restrict/delete/$', 'social.rest.privacy.note_restrict', {"undo": True}, name="note_privacy_restrict_undo"),
#    url(r'^note/(?P<note_id>[1-9][0-9]*)/privacy/allow/$', 'social.rest.privacy.note_allow', name="note_privacy_allow"),
#    url(r'^note/(?P<note_id>[1-9][0-9]*)/privacy/allow/delete/$', 'social.rest.privacy.note_allow', {"undo": True}, name="note_privacy_allow_undo"),
#    
#    url(r'^user/notes/privacy/restrict/$', 'social.rest.privacy.note_restrict', name="all_notes_privacy_restrict"),
#    url(r'^user/notes/privacy/restrict/delete/$', 'social.rest.privacy.note_restrict', {"undo": True}, name="all_notes_privacy_restrict_undo"),
#    url(r'^user/notes/privacy/allow/$', 'social.rest.privacy.note_allow', name="all_notes_privacy_allow"),
#    url(r'^user/notes/privacy/allow/delete/$', 'social.rest.privacy.note_allow', {"undo": True}, name="all_notes_privacy_allow_undo"),
#    
#    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/privacy/$', 'social.rest.privacy.photo_privacy', name="photo_privacy"),
#    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/privacy/restrict/$', 'social.rest.privacy.photo_restrict', name="photo_privacy_restrict"),
#    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/privacy/restrict/delete/$', 'social.rest.privacy.photo_restrict', {"undo": True}, name="photo_privacy_restrict_undo"),
#    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/privacy/allow/$', 'social.rest.privacy.photo_allow', name="photo_privacy_allow"),
#    url(r'^photo/(?P<photo_id>[1-9][0-9]*)/privacy/allow/delete/$', 'social.rest.privacy.photo_allow', {"undo": True}, name="photo_privacy_allow_undo"),
#    
#    url(r'^user/photos/privacy/restrict/$', 'social.rest.privacy.photo_restrict', name="all_photos_privacy_restrict"),
#    url(r'^user/photos/privacy/restrict/delete/$', 'social.rest.privacy.photo_restrict', {"undo": True}, name="all_photos_privacy_restrict_undo"),
#    url(r'^user/photos/privacy/allow/$', 'social.rest.privacy.photo_allow', name="all_photos_privacy_allow"),
#    url(r'^user/photos/privacy/allow/delete/$', 'social.rest.privacy.photo_allow', {"undo": True}, name="all_photos_privacy_allow_undo"),    
# 
#    url(r'^sound/(?P<sound_id>[1-9][0-9]*)/privacy/$', 'social.rest.privacy.sound_privacy', name="sound_privacy"),
#    url(r'^sound/(?P<sound_id>[1-9][0-9]*)/privacy/restrict/$', 'social.rest.privacy.sound_restrict', name="sound_privacy_restrict"),
#    url(r'^sound/(?P<sound_id>[1-9][0-9]*)/privacy/restrict/delete/$', 'social.rest.privacy.sound_restrict', {"undo": True}, name="sound_privacy_restrict_undo"),
#    url(r'^sound/(?P<sound_id>[1-9][0-9]*)/privacy/allow/$', 'social.rest.privacy.sound_allow', name="sound_privacy_allow"),
#    url(r'^sound/(?P<sound_id>[1-9][0-9]*)/privacy/allow/delete/$', 'social.rest.privacy.sound_allow', {"undo": True}, name="sound_privacy_allow_undo"),
# 
#    url(r'^user/sounds/privacy/restrict/$', 'social.rest.privacy.sound_restrict', name="all_sounds_privacy_restrict"),
#    url(r'^user/sounds/privacy/restrict/delete/$', 'social.rest.privacy.sound_restrict', {"undo": True}, name="all_sounds_privacy_restrict_undo"),
#    url(r'^user/sounds/privacy/allow/$', 'social.rest.privacy.sound_allow', name="all_sounds_privacy_allow"),
#    url(r'^user/sounds/privacy/allow/delete/$', 'social.rest.privacy.sound_allow', {"undo": True}, name="all_sounds_privacy_allow_undo"),
# 
#    url(r'^node/(?P<node_id>[1-9][0-9]*)/privacy/allow_all/$', 'social.rest.privacy.node_allow_all', name="node_privacy_allow_all"),
#    url(r'^node/(?P<node_id>[1-9][0-9]*)/privacy/allow_all/delete/$', 'social.rest.privacy.node_allow_all', {"undo": True}, name="node_privacy_allow_all_undo"),
#    url(r'^node/(?P<node_id>[1-9][0-9]*)/privacy/reset/$', 'social.rest.privacy.node_reset', name="node_privacy_reset"),
#===============================================================================

    url(r'^privacy/roles/$', 'social.rest.privacy.get_roles', name="roles"),
    url(r'^privacy/permissions/$', 'social.rest.privacy.get_permissions', name="permissions"),
)
